<?
include_once("../../config.inc.php");	
include_once ("../../class/mysqldb.inc.php");
$db=new mysqldb();
$id = $_GET['id'];
if(empty($id)){
	$id = 0;
}
$act = $_GET['act'];
$Money = $_GET['Money'];
$Money = trim($Money);
$TypeName = $_GET['TypeName'];
$TypeName = trim($TypeName);
if($act=="edit"){
	$sql="update hy_b_sendtype set TypeName = '".$TypeName."' , Money = ".$Money." where ID = ".$id;
	$db->query($sql);
}else if($act=="del"){
	$sql="delete from hy_b_sendtype where ID=".$id;
	$db->query($sql);
}else if($act=="add"){
	$sql="insert into hy_b_sendtype (TypeName,Money)values('".$TypeName."',".$Money.")";
	$db->query($sql);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator's Control Panel</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
<!--
function update(id,w){
	name = document.getElementById("TypeName"+id).value;
	money = document.getElementById("Money"+id).value;
	location.href="?act=edit&id="+id+"&TypeName="+name+"&Money="+money;
}
function add(){
	name = document.getElementById("addName").value;
	money = document.getElementById("addMoney").value;
	location.href="?act=add&TypeName="+name+"&Money="+money;
}
function del(w)
{	
	if(confirm("真的要删除吗？"))
		{	
		
		location.href="?act=del&id="+w
			return true
		}
}
function mOvr(src,clrOver)
{	
   if (!src.contains(event.fromElement))
	{	 src.bgColor = clrOver;
	}
}
function mOut(src,clrIn)
{	if (!src.contains(event.toElement))
	{	src.bgColor = clrIn;
	}
}
//-->
</script>
</head>
<body id="main" >
<?
$sql="SELECT * FROM `hy_b_sendtype` ";
$db->query($sql);
$rs=$db->get_data();
?>
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
    <td><h1>配送方式 </h1></td>
    <td width="100"><a href="sendmethod_add.php">新增</a></td>
  </tr>
</table> 
<table cellspacing="0" cellpadding="0" width="100%"  class="listtable">
    <tr> 
      <th width="12%">ID</th>
      <th width="23%">运输方式</th>
      <th width="13%">金额</th>
      <th width="30%">描述</th>
      <th width="9%">修改</th>
      <th width="10%">删除</th>
    </tr>
<?php
if($rs)
{
	foreach($rs as $rss)
	{
	?>
        <tr>
            <td><? echo $rss['ID'];?></td>
            <td><? echo $rss["TypeName"];?></td>
            <td><? echo $rss['Money'];?></td>
            <td><? echo $rss['Content'];?></td>
            <td><a href="sendmethod_add.php?id=<?=$rss['ID']?>" >修改</a></td>
            <td><a href="javascript:del(<?=$rss['ID']?>)">删除</a></td>
        </tr>
<?php
	}
}
?>
</table>
<?php include "../bottom.php"; ?>
</body>
</html>
